package net.huashitong.supervision.insideDuCha.service;

import com.sirdc.modules.core.dao.BaseDao;
import com.sirdc.modules.sys.base.StringPKService;
import com.sirdc.modules.sys.service.SysTableService;
import net.huashitong.supervision.insideDuCha.dao.InsideBackDao;
import net.huashitong.supervision.insideDuCha.entity.InsideBackEntity;
import net.huashitong.supervision.insideDuCha.filter.InsideBackFilter;
import net.huashitong.util.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class InsideBackService extends StringPKService<InsideBackEntity> {

    @Autowired
    private InsideBackDao dao;
    @Autowired
    private SysTableService tableService;

    @Override
    protected BaseDao<InsideBackEntity, String> getDao() {
        return dao;
    }


    @Override
    protected void beforeSave(InsideBackEntity obj) {
        String sysId = tableService.updateMaxSysId("inside_task_back", null);
        obj.setSysId(sysId);
    }

    /**
     * 保存
     * @param filter
     * @param createId
     */
    public void saveBackfeed(InsideBackFilter filter, String createId)
    {

        InsideBackEntity entity = new InsideBackEntity();

//        entity.setBackUserId(createId);


        beforeSave(entity);
        entity.setCreateDate(DateUtil.getCurrentDate());
        entity.setCreateTime(DateUtil.getCurrentTime());
        entity.setCreateUser(createId);
        entity.setBackUserId(createId);
        dao.save(entity);
    }

    public void getListBackfeeds()
    {
        dao.getInsideBacks();

    }
}
